<?php
namespace app\common\repositories\user;
use app\common\repositories\BaseRepository;
use app\common\dao\user\UserExtractDao as dao;
/**
 * @mixin dao
 */
class UserExtractRepository extends BaseRepository
{
    public function __construct(dao $dao)
    {
        $this->dao = $dao;
    }


    public function getApiList($where,$page,$limit)
    {
        $count = $this->dao->getSearch()->where($where)->count();
        $list = $this->dao->getSearch()->where($where)->order('extract_id desc')->page($page,$limit)->select();
        return compact('count','list');
    }


    public function getAdminLst($where,$page,$limit)
    {
        if(!$where['status'])
            $where = [];
        $count = $this->dao->getSearch()->where($where)->count();
        $list = $this->dao->getSearch()->where($where)->with(['user'=>function($query){
            $query->field('uid,nickname,avatar');
        }])->order('extract_id desc')->page($page,$limit)->select();
        return compact('count','list');
    }

}